export function getCookie(name){
	console.log(document.cookie);
    if(!document.cookie) return '';
	let cookies = document.cookie;
	if(!document.cookie.includes('access-token')) return '';

	return document.cookie.split("=")[1];
}


// 解析url, 获取参数
export function parseUrl(){
	let url = location.href.split('#')[0];
	let paramsOrigin = url.split('?')[1];
	if(!paramsOrigin) return {};
	let paramsArr = paramsOrigin.split('&');

	return paramsArr.reduce((obj, current)=>{
		let item = current.split('=');
		obj[item[0]] = item[1];
		return obj;
	}, {});
}

// 获取视频状态标记背景颜色
export function getVideoStatusColor(statusCode = '1'){
	let colorsMap = {
		'0': 'bg-color-gray',
		'1': 'bg-color-green',
		'2': 'bg-color-blue',
		'3': 'bg-color-orange'
	};
	
	return colorsMap[statusCode];
}